package b02static;

import java.util.ArrayList;

public class Student extends Person {
    private int no;
    private double scoreEn;
    private double scoreMath;
    private double scoreCh;

    public Student() {

    }
    public Student(int no, double scoreEn, double scoreMath, double scoreCh) {
        this.no = no;
        this.scoreEn = scoreEn;
        this.scoreMath = scoreMath;
        this.scoreCh = scoreCh;
    }

    public Student(String name, String sex, String age, int no, double scoreEn, double scoreMath, double scoreCh) {
        super(name, sex, age);
        this.no = no;
        this.scoreEn = scoreEn;
        this.scoreMath = scoreMath;
        this.scoreCh = scoreCh;
    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public double getScoreEn() {
        return scoreEn;
    }

    public void setScoreEn(double scoreEn) {
        this.scoreEn = scoreEn;
    }

    public double getScoreMath() {
        return scoreMath;
    }

    public void setScoreMath(double scoreMath) {
        this.scoreMath = scoreMath;
    }

    public double getScoreCh() {
        return scoreCh;
    }

    public void setScoreCh(double scoreCh) {
        this.scoreCh = scoreCh;
    }

    public double aver(){
        double aver=(scoreCh+scoreEn+scoreMath)/3;
        System.out.println(aver);
        return aver;
    }
    public void max(double[] arr){
        //arr[0]1
        //arr[1]2
        //arr[2]1
        double max=arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(max<arr[i]){
                max=arr[i];
            }
        }
    }
    public void min(double[] arr){
        double min=arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(min>arr[i]){
                min=arr[i];
            }
        }
    }

    @Override
    public String toString() {
        String a="姓名"+getName()+"性别"+getSex()+"年龄"+getAge()+"学号"+no+"平均分："+aver()+"最大成绩"+scoreMath+"最小成绩"+scoreCh;
        System.out.println(a);
        return a;
    }
}
